//
// Created by Administrator on 2024/3/11.
//
#include<bits/stdc++.h>

using namespace std;

int main() {
    map<string, int> M;
    int tot = 0;
    for (string w; cin >> w;) {
        M[w]++;
        tot++;
    }
    cout << tot << endl;
    for (auto &p:M) {
        cout << p.first << ":" << p.second << endl;
    }

    return 0;
}
